home *** CD-ROM | disk | FTP | other *** search
/ Champak 64 / Volume 64 - JOGO DISK .iso / Games / the_best_every_day.swf / scripts / __Packages / MainCTRL.as < prev    next >
Text File  |  2008-04-10  |  3KB  |  139 lines

  1. class MainCTRL
  2. {
  3.    function MainCTRL(p_mcRef)
  4.    {
  5.       this.mcRef = p_mcRef;
  6.       this.bInGame = false;
  7.       this.bMenuOpen = false;
  8.       this.bPaused = false;
  9.       this.nLevel = 1;
  10.       this.nFunds = 5000;
  11.       this.nScore = 0;
  12.       _global.Pack = this;
  13.       this.bBonus = false;
  14.    }
  15.    function TitleCard()
  16.    {
  17.       this.nScore = 0;
  18.       this.mcRef.stop();
  19.    }
  20.    function AdjustScore(p_Num)
  21.    {
  22.       this.nScore += p_Num;
  23.    }
  24.    function Play()
  25.    {
  26.       if(this.bInGame)
  27.       {
  28.          this.mcRef.instructions.gotoAndStop(1);
  29.          this.hidesMenu();
  30.          this.bMenuOpen = false;
  31.          this.unPauseGame();
  32.       }
  33.       else
  34.       {
  35.          _global.Transition.play();
  36.          _global.Transition.TransFunc = function()
  37.          {
  38.             _global.Pack.nScore = 0;
  39.             _global.Pack.mcRef.instructions.gotoAndStop(1);
  40.             _global.Pack.mcRef.gotoAndStop("Game");
  41.             _global.Pack.bInGame = true;
  42.          };
  43.       }
  44.    }
  45.    function pauseGame()
  46.    {
  47.       _global.C.oGame.oLevel.Paused();
  48.       _global.C.oGame.oLevel.oCam.pause();
  49.       _global.C.oGame.oLevel.update();
  50.       _global.C.oGame.oLevel.oPatrick.sDropPoint.mcItem.stop();
  51.       this.bPaused = true;
  52.    }
  53.    function unPauseGame()
  54.    {
  55.       if(_global.GS.mcGame.FinishScreen._currentframe <= 1)
  56.       {
  57.          _global.C.oGame.oLevel.unPaused();
  58.          _global.C.oGame.oLevel.oCam.unpause();
  59.          if(_global.C.oGame.oLevel.oPatrick.sDropPoint.mcItem._currentframe != _global.C.oGame.oLevel.oPatrick.sDropPoint.mcItem._totalframes)
  60.          {
  61.             _global.C.oGame.oLevel.oPatrick.sDropPoint.mcItem.play();
  62.          }
  63.          _global.C.oGame.oLevel.oPatrick.mc._parent._parent.mcSpongebob.gotoAndStop("Idle");
  64.          this.bPaused = false;
  65.       }
  66.    }
  67.    function Instruc()
  68.    {
  69.       this.mcRef.instructions.gotoAndStop(2);
  70.    }
  71.    function showsMenu()
  72.    {
  73.       this.mcRef.mcGame.mcMenu.gotoAndPlay("appear");
  74.       this.bMenuOpen = true;
  75.    }
  76.    function hidesMenu()
  77.    {
  78.       this.mcRef.mcGame.mcMenu.gotoAndPlay("disapear");
  79.       this.bMenuOpen = false;
  80.    }
  81.    function pressMenu()
  82.    {
  83.       if(this.bMenuOpen)
  84.       {
  85.          this.hidesMenu();
  86.          this.unPauseGame();
  87.       }
  88.       else
  89.       {
  90.          this.showsMenu();
  91.          this.pauseGame();
  92.       }
  93.    }
  94.    function Quit()
  95.    {
  96.       _global.MiniGame.ClearControls();
  97.       _global.C.oGame.oLevel.oPatrick.ClearControls();
  98.       this.mcRef.gotoAndStop("EndCard");
  99.       this.bMenuOpen = false;
  100.       this.bInGame = false;
  101.    }
  102.    function EndCard()
  103.    {
  104.       _global.Sounds.SwitchToPack();
  105.       this.bMenuOpen = false;
  106.       this.bPaused = false;
  107.       if(this.nLevel >= 6)
  108.       {
  109.          this.mcRef.gotoAndStop("WinCard");
  110.       }
  111.       this.nLevel = 1;
  112.       if(!_global.Pack.bBonus)
  113.       {
  114.          this.nFunds = 5000;
  115.       }
  116.       else
  117.       {
  118.          this.nFunds = 6000;
  119.       }
  120.    }
  121.    function Code()
  122.    {
  123.       this.oSecretCodeInterface = new SecretCodeInterface(this.mcRef.mcCode);
  124.       this.oSecretCodeInterface.show();
  125.       this.mcRef.mcCode.onEnterFrame = function()
  126.       {
  127.          _global.Pack.oSecretCodeInterface.update();
  128.       };
  129.    }
  130.    function unlockCode(__Code)
  131.    {
  132.       if(__Code == "sBONUS")
  133.       {
  134.          _global.Pack.bBonus = true;
  135.          this.nFunds = 6000;
  136.       }
  137.    }
  138. }
  139.